package cn.mingfancloud.bilibili_java.javabase.practice;

// 拷贝数据小实验


public class nide {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,};
        int[] nono =copy(arr,2,6);
        for (int i = 0; i < nono.length; i++) {
            System.out.print(nono[i]+" ");
        }
    }

    public static int[] copy(int[] arr,int from,int to ) {
        int[] newArry = new int[to - from];
        int index= 0;
        for (int i = from; i < to; i++) {
            newArry[index] =arr[i];
            index++;
        }
        return newArry;
    }
}
